package com.rchat.pocmini.activity.changepwd;

import android.view.View;
import android.widget.ProgressBar;

import com.airtalkee.sdk.AirtalkeeAccount;
import com.rchat.pocmini.R;
import com.rchat.pocmini.activity.view.ClearEditText;
import com.rchat.pocmini.common.mvp.BaseMvpActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by ljd on 2017/8/31.
 */

public class ChangePwdActivity extends BaseMvpActivity<ChangePwdPresenterImpl, ChangePwdModelImpl>
        implements ChangePwdContract.View {

    @BindView(R.id.et_old_pwd)
    ClearEditText etOldPwd;

    @BindView(R.id.et_pwd)
    ClearEditText etPwd;

    @BindView(R.id.et_pwd_confirm)
    ClearEditText etPwdConfirm;

    @BindView(R.id.pb)
    ProgressBar pb;


    @Override
    public void initPresenter() {
        mPresenter.setVM(this, mModel);
    }

    @Override
    public int getLayoutId() {
        return R.layout.change_password_activity_layouy;
    }

    @Override
    public void initView() {

    }

    @Override
    public void doAfterInitView() {

    }

    @OnClick({R.id.iv_back,
            R.id.iv_commit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.iv_commit:
                mPresenter.changePwd(etOldPwd.getText().toString().trim(),
                        etPwd.getText().toString().trim(),
                        etPwdConfirm.getText().toString().trim());
                break;
        }
    }

    @Override
    public void showPb(boolean show) {
        if (show) {
            pb.setVisibility(View.VISIBLE);
            return;
        }
        pb.setVisibility(View.GONE);
    }
}
